package com.myproject.yunPan;

import javax.swing.JOptionPane;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

import com.myproject.yunPan.ui.Login;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.TimeInterval;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.system.SystemUtil;

@SpringBootApplication
@EnableScheduling
public class YunPanApplication {

	private static final Logger LOG = LogManager.getLogger(YunPanApplication.class);

	public static void main(String[] args) {

		SpringApplication.run(YunPanApplication.class, args);
        String version = SystemUtil.getJavaSpecInfo().getVersion();
        if (!"1.8".equals(version)){
            JOptionPane.showMessageDialog(null, "你当前的JDK版本为【"+version+"】\n" +
                    "建议您使用JDK【1.8】来运行本程序", "温馨提示", JOptionPane.ERROR_MESSAGE);
        }
        TimeInterval timer = DateUtil.timer();

        ThreadUtil.execute(Login::initUpdate);
        

        //mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        LOG.info("启动耗时：" + timer.interval()+" ms");       
             
	}


}

